<template>
	<view class="content">
		<image class="logo" :src="buildInfo.thumb"></image>

		<view class="header-content">
			<view class="header-left">
				<view class="line"></view>
				<text class="header-title">基本信息</text>
			</view>
			<image class="header-content-share" src="../../static/images/icon/share_icon.png"></image>
		</view>
		<view class="info_list" >
			<text class="info_name">地&emsp;&emsp;区</text>
			<text class="info_value">{{buildInfo.area.name}}</text>
			<text class="info_name">楼盘名称</text>
			<text class="info_value">{{buildInfo.name}}</text>
			<text class="info_name">户&emsp;&emsp;型</text>
			<text class="info_value">{{buildInfo.model.name}}m²</text>
		</view>
		<view class="header-content">
			<view class="header-left">
				<view class="line"></view>
				<text class="header-title">地理位置</text></view>
				</view>
				<map @click.stop="getMap" style="width: 670npx; height:670rpx;":latitude="buildInfo.latitude"
				:longitude="buildInfo.longitude" :markers="over" :show-location="true">
				
				</map>
				<view class="header-content">
				<view class="header-left">
				<view class="line"></view>
				<text class="header-title">案例展示</text></view>
		</view>
		<view class="example-list" @click="tocade()">
			<view class="example-item">
				<image class="example-item-image" src="../../static/images/common/tancheng.png"></image>
				<view class="example-item-mark"><text class="example-item-size">30m²</text></view>
			</view>
			<view class="example-item">
				<image class="example-item-image" src="../../static/images/common/tancheng.png"></image>
				<view class="example-item-mark"><text class="example-item-size">80m²</text></view>
			</view>
			<view class="example-item">
				<image class="example-item-image" src="../../static/images/common/tancheng.png"></image>
				<view class="example-item-mark"><text class="example-item-size">30m²</text></view>
			</view>
			<view class="example-item">
				<image class="example-item-image" src="../../static/images/common/tancheng.png"></image>
				<view class="example-item-mark"><text class="example-item-size">80m²</text></view>
			</view>
		</view>
		<button class="submit">确定预约</button>
	</view>
</template>

<script>
export default {
	data() {
			return {
			buildInfo:{
				area:"",
				model:""
			},
			over:[]
			
			}
		},
	onLoad(e) {
		uni.request({
			url: 'https://baiyi.kent.work/api/v1/system/getBuildDetail',
			method: 'POST',
			data: {
				id:e.id //热改楼盘编号
			},
			success: res => {
				console.log(res)
				this.buildInfo=res.data.data.buildInfo
				this.over=[{
					"iconPath":"../../static/images/common/markers.png",
					"longitude":this.buildInfo.longitude,
					"latitude":this.buildInfo.latitude,
				    "height":30,
					"width":30
				}]
			},
			fail: () => {},
			complete: () => {}
		});
		
	},
	methods: {
		getMap(){
			uni.openLocation({
				latitude:parseFloat(this.buildInfo.latitude),
				longitude:parseFloat(this.buildInfo.longitude),
				name:this.buildInfo.name,
				success:function(){
					console.log('导航成功')
				},
				fail:function(error){
					console.log(error);
				}
			})
		},
		tocade(){
			uni.navigateTo({
				url: '../../pages/cade/cade',
				success: res => {},
				fail: () => {},
				complete: () => {}
			});
		}
	}
};
</script>

<style>
page {
	background-color: #f5f5f5;
}
.content {
	box-sizing: border-box;
	width: 100vw;
	display: flex;
	flex-direction: column;
	align-items: center;
}
.logo {
	width: 100%;
	height: 500rpx;
}
.info_list {
	box-sizing: border-box;
	font-size: 28rpx;
	grid-row-gap: 20rpx;
	padding: 0rpx 40rpx;
	width: 100%;
	display: grid;
	grid-template-columns: 40% 1fr;
}
.header-content {
	box-sizing: border-box;
	width: 100%;
	display: flex;
	align-items: center;
	padding: 40rpx 40rpx 26rpx 40rpx;
	justify-content: space-between;
}
.header-left {
	display: flex;
	align-items: center;
}
.header-title {
	font-family: PingFang SC, PingFang SC-Bold;
	color: #333333;
	font-size: 32rpx;
	font-weight: 700;
	margin-left: 20rpx;
}
.header-content-share {
	width: 38rpx;
	height: 38rpx;
}
.line {
	width: 8rpx;
	height: 30rpx;
	background: #3d9c36;
}
.info_name {
	font-family: PingFang SC, PingFang SC-Medium;
	color: #333333;
	font-size: 24rpx;
}
.info_value {
	font-family: PingFang SC, PingFang SC-Bold;
	color: #333333;
	font-size: 24rpx;
	font-weight: bold;
}

.example-list {
	box-sizing: border-box;
	display: grid;
	grid-template-columns: 1fr 1fr;
	grid-gap: 22rpx;
	padding: 0 40rpx;
	width: 100%;
}
.example-item {
	position: relative;
	border-radius: 16rpx;
	box-shadow: 0rpx 4rpx 2rpx rgba(0, 0, 0, 0.1);
}
.example-item-image {
	width: 100%;
	height: 200rpx;
}
.example-item-mark {
	position: absolute;
	width: 100%;
	height: 50rpx;
	background-color: white;
	bottom: 0;
	border-radius: 0 0 16rpx 16rpx;
	display: flex;
	align-items: center;
	justify-content: center;
}
.example-item-size {
	font-family: PingFang SC, PingFang SC-Bold;
	font-size: 28rpx;
}
.example-item-size::before {
	content: '— ';
	color: #3d9c36;
}
.example-item-size::after {
	content: ' —';
	color: #3d9c36;
}
.submit {
	box-sizing: border-box;
	height: 80rpx;
	width: 328rpx;
	color: #fff;
	font-size: 32rpx;
	background-color: #3d9c36;
	margin: 80rpx;
}
</style>
